def merge_matrices(*matrices):
    # 确保所有矩阵的行数相同
    row_lengths = set(len(matrix) for matrix in matrices)
    assert len(row_lengths) == 1, "所有矩阵的行数不相同"

    merged_matrix = [sum(rows, []) for rows in zip(*matrices)]
    return merged_matrix

matrix1 = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]

matrix2 = [
    [10, 11, 12],
    [13, 14, 15],
    [16, 17, 18]
]

matrix3 = [
    [19, 20, 21],
    [22, 23, 24],
    [25, 26, 27]
]

merged_matrix = merge_matrices(matrix1, matrix2, matrix3)
for row in merged_matrix:
    print(row)
